package com.longyiqun.cm.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.longyiqun.cm.domain.ModuleEntity;
import com.longyiqun.cm.domain.TestCaseEntity;
import com.longyiqun.cm.mapper.CasesMapper;
import com.longyiqun.cm.mapper.ModuleMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * program: CaseManager
 * package: com.longyiqun.cm.service
 * author: 龙轶群
 * create: 2018-04-13 19:33
 **/

@Service
public class ModuleServiceImpl implements ModuleService {

    @Autowired
    private ModuleMapper moduleMapper;

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public PageInfo getModuleForPaging(int pageIndex, int pageNum) {
        PageHelper.startPage(pageIndex, pageNum);
        List<ModuleEntity> list = moduleMapper.findAllModule();

        logger.error("Get Module count: " + list.size());
        PageInfo page = new PageInfo(list);
        return page;
    }
    public PageInfo getPlatFormForPaging(int pageIndex, int pageNum) {
        PageHelper.startPage(pageIndex, pageNum);
        List<ModuleEntity> list = moduleMapper.findAllPaltForm();

        logger.error("Get PaltForm count: " + list.size());
        PageInfo page = new PageInfo(list);
        return page;
    }
    public PageInfo getLeaderFormForPaging(int pageIndex, int pageNum) {
        PageHelper.startPage(pageIndex, pageNum);
        List<ModuleEntity> list = moduleMapper.findAllLeaderForm();

        logger.error("Get Leader count: " + list.size());
        PageInfo page = new PageInfo(list);
        return page;
    }

    public PageInfo getServerFormForPaging(int pageIndex, int pageNum) {
        PageHelper.startPage(pageIndex, pageNum);
        List<ModuleEntity> list = moduleMapper.findAllServerNameForm();

        logger.error("Get Server count: " + list.size());
        PageInfo page = new PageInfo(list);
        return page;
    }
}
